package com.example.sq.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.security.RolesAllowed;

@Controller
public class LoginController {

    @RequestMapping("/login")
    public String login(){
        return "login";
    }

    @RequestMapping("/loginPost")
    @ResponseBody
    public String  loginPost(){
        return "登录成功";
    }

    @PreAuthorize("hasAnyRole('admin', 'vip')")
    @RequestMapping("/")
    @ResponseBody
    public String index(){
        return "进入首页";
    }

}
